<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html> <head>
<title>Render Tests</title>
<script src="../../src/util/sets.js"></script>
<script src="../../src/util/render.js"></script>
<script src="../../site/esparser/bundle.js"></script>
</head>

<body>
<h1>Sets Tests</h1>

<style>
.running { background-color: yellow }
.pass { background-color: #afa }
.fail { background-color: #faa }
</style>

<ul id=testcases>
  <li>[]</li>
  <li>("")</li>
  <li>("x")</li>
  <li>("\"foo\"")</li>
  <li>"use strict"</li>
  <li>true</li>
  <li>0</li>
  <li>-1</li>
  <li>[[],,1,{}]</li>
  <li>{}</li>
  <li>{foo:bar}</li>
  <li>({})</li>
  <li>({"foo":bar})</li>
  <li>for (;;){}</li>
  <li>do {} while (1)</li>
  <li>while (1){}</li>
  <li>for (var o in k){}</li>
  <li>function a(b,c){return d}</li>
  <li>(function (a){throw new Error(a)})</li>
  <li>(function x(){})()</li>
  <li>({}["x"])</li>
  <li>{}{}</li>
  <li>{};{;}</li>
  <li>delete a["b"]</li>
  <li>typeof null</li>
  <li>a in b</li>
  <li>a instanceof T</li>
  <li>a+=1</li>
  <li>((++x),(y++))</li>
  <li>((--x),(y--))</li>
  <li>(a)/b</li>
  <li>(a)/=b</li>
  <li>(/a/i)</li>
  <li>switch (x){case 0:case 1:return true;default:break;}</li>
  <li>continue;continue foo;break;break bar</li>
  <li>try {foo()} catch (e){panic()}</li>
  <li>try {foo()} catch (e){panic()} finally {recover()}</li>
  <li>try {foo()} finally {recover()}</li>
  <li>if (cond)x;else if (cond2)then();else blah();</li>
  <li>({get "x"(){return 1}})</li>
  <li>this</li>
  <li>with(obj){}</li>
  <li>eval()</li>
  <li>eval("foo")</li>
  <li>eval("foo",bar)</li>
</ul>

<script>
(function () {
  var testcaseCont = document.getElementById('testcases');
  for (var testcase = testcaseCont.firstChild; testcase;
       testcase = testcase.nextSibling) (function (testcase) {
    if (testcase.nodeType !== 1) { return; }
    setTimeout(function () {
      var testText = testcase.firstChild.nodeValue;
      var hasConsole = typeof console !== 'undefined' && console.group;
      if (hasConsole) { console.group(testText); }
      try {
        testcase.className = 'running';
        var ast = ES5Parser.matchAll(testText, 'Program', [], function () {});
        var expected = testText;
        var result = renderEcmascript(ast);
        var passed = ('' + result) === ('' + expected);
        var message;
        if (!passed) {
          message = 'was ' + result;
        }
        if (!passed) {
          testcase.appendChild(document.createTextNode('; was ' + result));
        }
        testcase.className = passed ? 'pass' : 'fail';
      } finally {
        if (hasConsole) { console.groupEnd(); }
      }
    }, 0);
  })(testcase);
})();
</script>

<hr>
<address></address>
<!-- hhmts start --> Last modified: Fri Jan 15 13:12:22 PST 2010 <!-- hhmts end -->
</body> </html>
